home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / SimpleFaro.dxr / case keeper_61_deal d s.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  2.3 KB  |  73 lines

  1. property winMe, loseMe, spriteNum
  2. global deck, points, gPlayerBets, playerCredits, cardList, complist, bettext, winSprite, loseSprite, losingDen, winningDen
  3.  
  4. on mouseEnter me
  5.   sprite(spriteNum).member = member(sprite(spriteNum).member.name & "2")
  6. end
  7.  
  8. on mouseLeave me
  9.   sprite(spriteNum).member = member(chars(sprite(spriteNum).member.name, 1, sprite(spriteNum).member.name.char.count - 1))
  10. end
  11.  
  12. on mouseDown
  13.   bettext.text = "0"
  14.   if (cardList.count = 3) and not cardList.findPos(#holder) then
  15.     shuffle(complist)
  16.     if (getColor(sprite(cardList[1]).member.name) = getColor(string(complist[1].mGetImage()))) and (getColor(sprite(cardList[2]).member.name) = getColor(string(complist[2].mGetImage()))) and (getColor(sprite(cardList[3]).member.name) = getColor(string(complist[3].mGetImage()))) and ((getDenom(sprite(cardList[1]).member.name) = complist[1].pRank) and (getDenom(sprite(cardList[2]).member.name) = complist[2].pRank) and (getDenom(sprite(cardList[3]).member.name) = complist[3].pRank)) then
  17.       points = points + 200
  18.       playerCredits.text = string(points)
  19.     else
  20.       points = points - 50
  21.       playerCredits.text = string(points)
  22.     end if
  23.     the itemDelimiter = ","
  24.     repeat with i = 1 to 3
  25.       puppetSound(3, member("deal card", "100GPak Generic SFX"))
  26.       sprite(13 + i).member = complist[i].mGetImage()
  27.       sprite(13 + i).blend = 100
  28.       sprite(sprite(13 + i).textu).member.text = EMPTY
  29.       updateStage()
  30.     end repeat
  31.     deck = VOID
  32.     deck = new(script("deck of cards"))
  33.     deck.mRemoveFromDeck(deck.mDrawCard(#top))
  34.     if points <= 0 then
  35.       s = the ticks + 50
  36.       repeat while the ticks < s
  37.         nothing()
  38.       end repeat
  39.       go("game over")
  40.     else
  41.       repeat with i in ["ace", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "jack", "queen", "king"]
  42.         member(i && "text").text = "0/0"
  43.       end repeat
  44.       complist.deleteAll()
  45.       cardList.deleteAll()
  46.       go(2)
  47.     end if
  48.   end if
  49. end
  50.  
  51. on shuffle aList
  52.   uo = []
  53.   repeat while uo.count < 3
  54.     temp = aList[random(aList.count)]
  55.     uo.add(temp)
  56.     aList.deleteOne(temp)
  57.   end repeat
  58.   complist = uo
  59. end
  60.  
  61. on getColor arg
  62.   if (arg contains "hearts") or (arg contains "diamonds") then
  63.     return #redd
  64.   else
  65.     return #black
  66.   end if
  67. end
  68.  
  69. on getDenom arg
  70.   the itemDelimiter = "_"
  71.   return symbol(arg.item[1])
  72. end
  73.